﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GeneralDFS.BusinessLogical.Lease
{
    public class LeaseManager
    {
        private readonly Dictionary<String, List<Lease>> _leases;

        public LeaseManager()
        {
            _leases = new Dictionary<string, List<Lease>>(5);
        }

        private List<Lease> Add(String src)
        {
            if (_leases.ContainsKey(src))
                return _leases[src];
            var lease = new List<Lease>();
            _leases.Add(src,lease);
            return lease;
        }

        public Boolean AcquireRead(String src, Guid tranID)
        {
            var leases = Add(src);
            var leaseList = (from lease in leases
                             where lease.Guid == tranID
                             select lease).ToList();
            if (leaseList.Count > 0)
            {
                
            }

            throw new NotImplementedException();
        }

        public Boolean AcquireWrite(String src, Guid tranID)
        {
            throw new NotImplementedException();
        }

        public Boolean AcquireDelete(String src, Guid tranID)
        {
            throw new NotImplementedException();
        }
    }
}
